﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace eLearning.Pages.PanelUtilities
{
    public class ButtonClose : ButtonEvent
    {
        private Panel SuperParent;
        public ButtonClose() : base ()
        {
            base.MouseLeftButtonDown += new MouseButtonEventHandler(ButtonEvent_Click);
            base.Loaded += new RoutedEventHandler(ButtonClose_Loaded);
        }

        void ButtonClose_Loaded(object sender, RoutedEventArgs e)
        {
            base.ButtonEvent_Loaded (sender, e);
            SuperParent = ButtonEvent.FindParent<Panel>(base.ParentPanel);            
        }

        protected override void ButtonEvent_Click(object sender, RoutedEventArgs e)
        {
            base.ButtonEvent_Click(sender, e);
            //base.ParentPanel.Visibility = Visibility.Collapsed;
            this.SuperParent.Children.Remove(base.ParentPanel);
        }

        //public delegate void MouseMoveHandler(object sender, RoutedEventArgs e);
        //public event MouseEventHandler MouseMove;
    }
}
